package jiazhong.Dao;


import jiazhong.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.HashMap;
import java.util.List;

public interface IUsersDao {
//查询所有用户
    @Select("select  * from user")
    List<User> findAll();

    @Insert("insert into user(id,name,password,nickname) values (#{id},#{name},#{password},#{nickname})")
    void saveUser(User user);

    @Update("update user set name =#{name},password=#{password},nickname=#{nickname} where id=#{id}")
    void updateUser(User user);

    @Delete("select from user where id=#{id}")
    void deleteUser(User user);

    @Select("select * from user where id=#{id}")
    List<User> findone(User user);

    @Select("select * from user where password like '%${value}%'")
    List<User> findlike(String password);

    @Select("select count(*) from user")
    int findtotal();
}
